home *** CD-ROM | disk | FTP | other *** search
- //simple shader to clip any pixels with a Z coordinate below the water plane
- //does not apply lights
- //applies vertex diffuse colors and texture sampling
- //must be used with clipZ2.psh
- //Luke Lenhart
- //(C)2004-2005 Digipen Institute of Technology
-
- //world,view,projection transform
- float4x4 matWorldViewProj;
- float4x4 matWorld;
-
- //shader input
- struct VS_INPUT
- {
- float4 Pos : POSITION;
- float2 Tex0 : TEXCOORD0;
- float4 Clr : COLOR0;
- };
-
- //shader output
- struct VS_OUTPUT
- {
- float4 Pos0 : POSITION;
- float PosZ : TEXCOORD1;
- float2 Tex0 : TEXCOORD0;
- float4 Clr : COLOR0;
- };
-
- //shader code
- VS_OUTPUT VShader(VS_INPUT In)
- {
- VS_OUTPUT Out;
-
- //copy tex coord
- Out.Tex0=In.Tex0;
-
- //calc transformed position
- Out.Pos0=mul(matWorldViewProj,In.Pos);
- float4 wPos=mul(matWorld,In.Pos);
- Out.PosZ=wPos.z;
-
- //copy color
- Out.Clr=In.Clr;
-
- //spit out the results
- return Out;
- }
-